package _4ChapterFore._1DecomposeConditional;

import java.util.Date;

public class Main {
    int winterRate = 10;
    int summerRate = 15;
    int winterServiceCharge = 20;
    public static final Date SUMMER_START = new Date();
    public static final Date SUMMER_END = new Date();

    public double fun1(Date date,int quantity){
        if (date.before(SUMMER_START) || date.after(SUMMER_END)){
            return quantity * winterRate + winterServiceCharge;
        }else {
            return quantity * summerRate;
        }
    }

    public double fun2(Date date,int quantity){
        if (onSummer(date)){
            return winterCharge(quantity);
        }else {
            return summerCharge(quantity);
        }
    }

    private double summerCharge(int quantity){
        return quantity * summerRate;
    }

    private double winterCharge(int quantity){
        return quantity * winterRate + winterServiceCharge;
    }

    private boolean onSummer(Date date){
        return date.before(SUMMER_START) || date.after(SUMMER_END);
    }
}
